<template>
  <div>
    <MyDragTable
      :columnList="columnList"
      :tableData="tableData"
      :isSlotSelect="true"
      @handleSelectionChange="handleSelectionChange"
    >
      <template #slotCheckBox>
        <el-table-column type="selection" width="55" />
      </template>
      <template #slotOperation>
        <el-table-column label="편집" fixed="right" width="140" align="center">
          <template #default="{ row }">
            <el-button type="primary" size="small" @click="withdrawEditHandle(row)">승인</el-button>
            <el-button type="warning" size="small" @click="withdrawDeleteHandle(row)"
              >반려</el-button
            >
          </template>
        </el-table-column>
      </template>
    </MyDragTable>
  </div>
</template>
<script lang="ts" setup>
import MyDragTable from '@/components/MyDragTable';
import columnListConfig from './columnList.ts';

const columnList = ref(columnListConfig);

const handleSelectionChange = (val: any) => {
  console.log(val.slice(0));
};

const withdrawEditHandle = (row: any) => {
  console.log(row);
};

const withdrawDeleteHandle = (row: any) => {
  console.log(row);
};

const tableData = ref([
  {
    guid: 123,
    agent_player_id: 456,
    agent_player_name: 'aaa',
    phone_number: {
      value: '0101111233',
      type: 'danger'
    }
  },

  {
    guid: 123,
    agent_player_id: 456,
    agent_player_name: 'aaa',
    phone_number: {
      value: '0101111222',
      type: 'success',
      handle: function (val: any) {
        console.log(val);
      }
    }
  }
]);
</script>
